<?php
//data connection file
require("includes/basic.php");
$email = $_POST['uname'];
if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))
{
$cust = "select * from customer_master where user_name='$email'";
$rsd = mysql_query($cust);
if($msg = mysql_num_rows($rsd)>0)
	{
		$msg= "Already exists";
	}
	else
	{
		$client = "select * from client_master where user_name='$email'";	
		$rcli =mysql_query($client);
		if(mysql_num_rows($rcli)>0)
		{
			$msg= "Already exists";
		}
		else
		{
			$user = "Select * from user_master where user_name='$email'";
			$ruser = mysql_query($user);
			if(mysql_num_rows($ruser)>0)
			{
				$msg= "Already exists";
			}
			else
			{
				$vender = "select * from vendor_master where user_name='$email'";
				$rvender = mysql_query($vender);
				if(mysql_num_rows($rvender)>0)
				{
					$msg = "Already exists";
				}
				else
				{
				$msg= "Available";
				}
			}
		}
	}
}
else
{
	$msg="";
}
echo '<b style="color:#FF0000;">'.$msg.'</b>';
?>